@ GNU AS assembler header file for Menu
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:50:29 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 5 Sept 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef Menu_Hdr
#  define Menu_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_Toolbox
#    define Get_Toolbox
#    include "oslib/Toolbox.Hdr"
#  endif

@Symbols for constants
#  define Class_Menu 0x828c0
#  define Menu_GenerateAboutToBeShown 0x1
#  define Menu_GenerateDialogueCompleted 0x2
#  define Menu_GenerateHasBeenHidden 0x2
#  define Menu_EntryTicked 0x1
#  define Menu_EntrySeparate 0x2
#  define Menu_EntryFaded 0x100
#  define Menu_EntryIsSprite 0x200
#  define Menu_EntrySubMenu 0x400
#  define Menu_EntryGenerateSubMenuAction 0x800
#  define Menu_EntryIsMenu 0x1000
#  define Action_MenuAboutToBeShown 0x828c0
#  define Action_MenuDialogueCompleted 0x828c1
#  define Action_MenuHasBeenHidden 0x828c1
#  define Action_MenuSubMenu 0x828c2
#  define Action_MenuSelection 0x828c3
#  define Error_MenuTasksActive 0x80aa00
#  define Error_MenuAllocFailed 0x80aa01
#  define Error_MenuShortBuffer 0x80aa02
#  define Error_MenuNoSuchTask 0x80aa11
#  define Error_MenuNoSuchMethod 0x80aa12
#  define Error_MenuNoSuchMiscOpMethod 0x80aa13
#  define Error_MenuNoSuchComponent 0x80aa14
#  define Error_MenuSpriteNotText 0x80aa21
#  define Error_MenuTextNotSprite 0x80aa22
#  define Error_MenuNoTopMenu 0x80aa31
#  define Error_MenuUnknownSubMenu 0x80aa32
#  define Error_MenuNoSpriteName 0x80aa33
#  define Menu_ShowPersistent 0x0
#  define Menu_ShowTransient 0x1
#  define Menu_AddBefore 0x1
#  define Menu_AddAtStart 0xffffffff
#  define Menu_AddAtEnd 0xfffffffe

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Bits
Menu_Flags                     : 

        .struct 0
        .skip   Bits
Menu_EntryFlags                : 

        .struct 0
Menu_EntryObject_flags         : .skip   Menu_EntryFlags
Menu_EntryObject_cmp           : .skip   Toolbox_C
Menu_EntryObject_text          : .skip   Toolbox_MsgReference
Menu_EntryObject_text_limit    : .skip   Int
Menu_EntryObject_click_object_name: .skip   Toolbox_StringReference
Menu_EntryObject_sub_menu_object_name: .skip   Toolbox_StringReference
Menu_EntryObject_sub_menu_action: .skip   Bits
Menu_EntryObject_click_action  : .skip   Bits
Menu_EntryObject_help          : .skip   Toolbox_MsgReference
Menu_EntryObject_help_limit    : .skip   Int
Menu_EntryObject               : 

        .struct 0
Menu_Object_flags              : .skip   Menu_Flags
Menu_Object_title              : .skip   Toolbox_MsgReference
Menu_Object_title_limit        : .skip   Int
Menu_Object_help               : .skip   Toolbox_MsgReference
Menu_Object_help_limit         : .skip   Int
Menu_Object_show_action        : .skip   Bits
Menu_Object_hide_action        : .skip   Bits
Menu_Object_entry_count        : .skip   Int
Menu_Object_entries            : .skip   Menu_EntryObject
Menu_Object                    : 
        
        .altmacro
        .macro  Menu_Object_MEMBERS label
\label&_flags                  : .skip   Menu_Flags
\label&_title                  : .skip   Toolbox_MsgReference
\label&_title_limit            : .skip   Int
\label&_help                   : .skip   Toolbox_MsgReference
\label&_help_limit             : .skip   Int
\label&_show_action            : .skip   Bits
\label&_hide_action            : .skip   Bits
\label&_entry_count            : .skip   Int
        .endm
        
        .struct 0
        Menu_Object_MEMBERS Menu_ObjectBase
Menu_ObjectBase                : 

        .struct 0
        Toolbox_ResourceFileObject_MEMBERS Menu_ObjectTemplate
Menu_ObjectTemplate_objectflags: .skip   Menu_Flags
Menu_ObjectTemplate_title      : .skip   Toolbox_MsgReference
Menu_ObjectTemplate_title_limit: .skip   Int
Menu_ObjectTemplate_help       : .skip   Toolbox_MsgReference
Menu_ObjectTemplate_help_limit : .skip   Int
Menu_ObjectTemplate_show_action: .skip   Bits
Menu_ObjectTemplate_hide_action: .skip   Bits
Menu_ObjectTemplate_entry_count: .skip   Int
Menu_ObjectTemplate_entries    : .skip   Menu_EntryObject
Menu_ObjectTemplate            : 
        
        .altmacro
        .macro  Menu_ObjectTemplate_MEMBERS label
        Toolbox_ResourceFileObject_MEMBERS \label
\label&_objectflags            : .skip   Menu_Flags
\label&_title                  : .skip   Toolbox_MsgReference
\label&_title_limit            : .skip   Int
\label&_help                   : .skip   Toolbox_MsgReference
\label&_help_limit             : .skip   Int
\label&_show_action            : .skip   Bits
\label&_hide_action            : .skip   Bits
\label&_entry_count            : .skip   Int
        .endm
        
        .struct 0
        Menu_ObjectTemplate_MEMBERS Menu_ObjectTemplateBase
Menu_ObjectTemplateBase        : 

        .struct 0
        .skip   OS_Coord
Menu_Full                      : 

        .struct 0
        Toolbox_ActionHeader_MEMBERS Menu_ActionAboutToBeShownBlock
Menu_ActionAboutToBeShownBlock_tag: .skip   Toolbox_PositionTag
Menu_ActionAboutToBeShownBlock_position: 
Menu_ActionAboutToBeShownBlock_position_top_left: .skip   OS_Coord
        .struct Menu_ActionAboutToBeShownBlock_position
Menu_ActionAboutToBeShownBlock_position_full: .skip   Menu_Full
Menu_ActionAboutToBeShownBlock : 

        .struct 0
Menu_ActionAboutToBeShown_tag  : .skip   Toolbox_PositionTag
Menu_ActionAboutToBeShown_position: 
Menu_ActionAboutToBeShown_position_top_left: .skip   OS_Coord
        .struct Menu_ActionAboutToBeShown_position
Menu_ActionAboutToBeShown_position_full: .skip   Menu_Full
Menu_ActionAboutToBeShown      : 

        .struct 0
        .skip   Toolbox_ActionHeaderBase
Menu_ActionHasBeenHiddenBlock  : 

        .struct 0
        .skip   Toolbox_ActionHeaderBase
Menu_ActionDialogueCompletedBlock: 

        .struct 0
Menu_ActionSubMenu_pos         : .skip   OS_Coord
Menu_ActionSubMenu             : 

        .struct 0
        Toolbox_ActionHeader_MEMBERS Menu_ActionSubMenuBlock
Menu_ActionSubMenuBlock_pos    : .skip   OS_Coord
Menu_ActionSubMenuBlock        : 

        .struct 0
        .skip   Toolbox_ActionHeaderBase
Menu_ActionSelectionBlock      : 

        .struct 0
        .skip   Bits
Menu_ShowFlags                 : 

        .struct 0
        .skip   Bits
Menu_AddFlags                  : 

        .struct 0
        .skip   Toolbox_C
Menu_AddAt                     : 


@Symbols for SWI's and SWI reason codes
.set XMenu_ClassSWI,0xa28c0
.set Menu_ClassSWI,0x828c0

.set XMenu_PostFilter,0xa28c1
.set Menu_PostFilter,0x828c1

.set XMenu_PreFilter,0xa28c2
.set Menu_PreFilter,0x828c2

.set XMenu_UpdateTree,0xa28c3
.set Menu_UpdateTree,0x828c3
   @Entry
   @  R0 = flags (Bits)
   @Exit
   @  R0 corrupted

#  define Menu_SetTick 0x0
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &0
   @  R3 = entry (Toolbox_C)
   @  R4 = tick (Bool)

#  define Menu_GetTick 0x1
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &1
   @  R3 = entry (Toolbox_C)
   @Exit
   @  R0 = tick (Bool)

#  define Menu_SetFade 0x2
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &2
   @  R3 = entry (Toolbox_C)
   @  R4 = fade (Bool)

#  define Menu_GetFade 0x3
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &3
   @  R3 = entry (Toolbox_C)
   @Exit
   @  R0 = fade (Bool)

#  define Menu_SetEntryText 0x4
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &4
   @  R3 = entry (Toolbox_C)
   @  R4 -> text (String)

#  define Menu_GetEntryText 0x5
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &5
   @  R3 = entry (Toolbox_C)
   @  R4 = buffer (pointer to String)
   @  R5 = size (Int)
   @Exit
   @  R5 = used (Int)

#  define Menu_SetEntrySprite 0x6
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &6
   @  R3 = entry (Toolbox_C)
   @  R4 -> sprite_name (String)

#  define Menu_GetEntrySprite 0x7
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &7
   @  R3 = entry (Toolbox_C)
   @  R4 = buffer (pointer to String)
   @  R5 = size (Int)
   @Exit
   @  R5 = used (Int)

#  define Menu_SetSubMenuShow 0x8
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &8
   @  R3 = entry (Toolbox_C)
   @  R4 = sub_menu (Toolbox_O)

#  define Menu_GetSubMenuShow 0x9
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &9
   @  R3 = entry (Toolbox_C)
   @Exit
   @  R0 = sub_menu (Toolbox_O)

#  define Menu_SetSubMenuAction 0xa
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &A
   @  R3 = entry (Toolbox_C)
   @  R4 = action (Bits)

#  define Menu_GetSubMenuAction 0xb
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &B
   @  R3 = entry (Toolbox_C)
   @Exit
   @  R0 = action (Bits)

#  define Menu_SetClickShow 0xc
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &C
   @  R3 = entry (Toolbox_C)
   @  R4 = show (Toolbox_O)
   @  R5 = show_flags (Menu_ShowFlags)

#  define Menu_GetClickShow 0xd
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &D
   @  R3 = entry (Toolbox_C)
   @Exit
   @  R0 = show (Toolbox_O)
   @  R1 = show_flags (Menu_ShowFlags)

#  define Menu_SetClickAction 0xe
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &E
   @  R3 = entry (Toolbox_C)
   @  R4 = action (Bits)

#  define Menu_GetClickAction 0xf
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &F
   @  R3 = entry (Toolbox_C)
   @Exit
   @  R0 = action (Bits)

#  define Menu_SetHelpMessage 0x10
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &10
   @  R3 -> help (String)

#  define Menu_GetHelpMessage 0x11
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &11
   @  R3 = buffer (pointer to String)
   @  R4 = size (Int)
   @Exit
   @  R4 = used (Int)

#  define Menu_SetEntryHelpMessage 0x12
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &12
   @  R3 = entry (Toolbox_C)
   @  R4 -> help (String)

#  define Menu_GetEntryHelpMessage 0x13
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &13
   @  R3 = entry (Toolbox_C)
   @  R4 = buffer (pointer to String)
   @  R5 = size (Int)
   @Exit
   @  R5 = used (Int)

#  define Menu_AddEntry 0x14
   @Entry
   @  R0 = flags (Menu_AddFlags)
   @  R1 = menu (Toolbox_O)
   @  R2 = &14
   @  R3 = at (Menu_AddAt)
   @  R4 -> entry (Menu_EntryObject)
   @Exit
   @  R0 = entry_out (Toolbox_C)

#  define Menu_RemoveEntry 0x15
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &15
   @  R3 = entry (Toolbox_C)

#  define Menu_GetHeight 0x16
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &16
   @Exit
   @  R0 = height (Int)

#  define Menu_GetWidth 0x17
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &17
   @Exit
   @  R0 = width (Int)

#  define Menu_SetTitle 0x18
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &18
   @  R3 -> title (String)

#  define Menu_GetTitle 0x19
   @Entry
   @  R0 = flags (Bits)
   @  R1 = menu (Toolbox_O)
   @  R2 = &19
   @  R3 = buffer (pointer to String)
   @  R4 = size (Int)
   @Exit
   @  R4 = used (Int)

#endif
